package cn.jiyun.controller;

import cn.jiyun.dao.Topic.TopicDTO;
import cn.jiyun.dao.answer.Answer;
import cn.jiyun.dao.paper.PaperDTO;
import cn.jiyun.feign.PaperFeign;
import cn.jiyun.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author 王晨
 * Date 2023/8/29
 */
@RestController
@RequestMapping("/paper")
public class PaperController {
    @Autowired
    private PaperFeign paperFeign;


    @RequestMapping("/findTopic")//查询试题表
    public R findTopic(TopicDTO topicDTO){
        return paperFeign.findAll(topicDTO);
    }
    @RequestMapping("/addAnswer")//添加答案
    public R addAnswer(Answer answer){
        return paperFeign.addAnswer(answer);
    }
    @RequestMapping("/findAnswer")//查询答案用于回显
    public R findAnswer(Integer id){
        return paperFeign.findAnswer(id);
    }

    @RequestMapping("/findPaper")//查询试卷表中数据
    public R findPaper(PaperDTO paperDTO){
        return paperFeign.findPaper(paperDTO);
    }
    @RequestMapping("/delAnswer")//删除答案表中数据
    public R delAnswer(Integer id){
        return paperFeign.delAnswer(id);
    }

    @RequestMapping("/findScore")//查询成绩
    public R findScore(){
        return paperFeign.findScore();
    }
}
